package com.r09er.imagemagic;

import org.im4java.core.ConvertCmd;
import org.im4java.core.IM4JavaException;
import org.im4java.core.IMOperation;

import java.io.IOException;

public class TransportTest {
    public static void main(String[] args) {
        IMOperation imOperation = new IMOperation();
        imOperation.addImage("C:\\Users\\Administrator\\Downloads\\cloth_origin.jpg");
        //容错
//        imOperation.fuzz(30000d);
        //扣背景
        imOperation.transparent("rgb(1,1,1)");
        imOperation.addImage("C:\\Users\\Administrator\\Downloads\\cloth_after.jpg");

        ConvertCmd convertCmd = new ConvertCmd();
        convertCmd.setSearchPath("D:\\Program Files\\ImageMagick-7.1.1-Q16-HDRI");
        try {
            convertCmd.run(imOperation);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } catch (IM4JavaException e) {
            throw new RuntimeException(e);
        }
    }
}
